/*
	flad : Copyright 2010 Dale J Williams

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
*/
package lads.flad.scene.entities {
	
	import lads.flad.GameCore;
	import lads.flad.scene.SceneObject;
	import lads.flad.utils.QuickMath;
	import flash.geom.Rectangle;
	
	/**
	 * Entity: A base class designed for live entity SceneObjects
	 * @author Dale J Williams
	 * @version 1.2
	 */
	public class Entity extends SceneObject {
		
		public function Entity($name:String) {
			autoBounds = true;
			super($name);
		}
		
		/// distanceTo will calculate the triangular distance between this and the co-ordinates provided
		public function distanceTo($x:Number, $y:Number):Number {
			var dX:Number = $x - x;
			var dY:Number = $y - y;
			return Math.sqrt(dX * dX + dY * dY);
		}
		
		/// angleTo will calculate the angle, in degrees, to the co-ordinates provided
		public function angleTo($x:Number, $y:Number):Number {
			return Math.atan2(y - $y, x - $x) * QuickMath.DEGREES - 90;
		}
		
	}

}